import 'package:love_app/common/su_dio.dart';
import 'package:love_app/config/path_url.dart';
import 'package:love_app/model/community_model.dart';
import 'package:love_app/model/dynamic_center_model.dart';
import 'package:love_app/model/dynamic_user_info_model.dart';
import 'package:love_app/model/response_model.dart';

class DynamicCenterApi {

  // 通过id获取个人简介
  static Future<DynamicUserInfoModel> dynamicUserInfo(int userId, String token)async{
    String path = PathUrl.dynamicUserInfo + "$userId";
    Map header = {
      "X-Auth-Token": token,
    };
    ResponseModel responseModel = await SuDio().getRequest(path, headersMap: header);
    DynamicUserInfoModel model = DynamicUserInfoModel.fromJson(responseModel.toJsonModel);
    return model;
  }

  // 通过id获取个人中心内容
  static Future<CommunityModel> dynamicUserCenter(int userId, String token, int page)async{
    String path = PathUrl.dynamicUserCenter + "$userId" + "/page/$page";
    Map header = {
      "X-Auth-Token": token,
    };
    ResponseModel responseModel = await SuDio().getRequest(path, headersMap: header);
    CommunityModel model = CommunityModel.fromJson(responseModel.toJsonModel);
    return model;
  }
}